package com.sxz.sbs.module.staff.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sxz.sbs.R;
import com.sxz.sbs.app.GlideApp;
import com.sxz.sbs.module.staff.mode.StaffDisposeBean;

import java.util.List;

import static com.sxz.sbs.R.id.tiv_dispose_staff_head;

/**
 * 员工处理  --- 交换对接 或 离职  适配器
 */

public class StaffDisposeAdapter extends BaseQuickAdapter<StaffDisposeBean.ListBean,BaseViewHolder>{
    /**
     * 默认交换
     */
    private DisposeEnum type = DisposeEnum.SWAP;
    public StaffDisposeAdapter(DisposeEnum type,@Nullable List<StaffDisposeBean.ListBean> data) {
        super(R.layout.item_staff_dispose_layout,data);
        this.type = type;
    }

    @Override
    protected void convert(BaseViewHolder helper, StaffDisposeBean.ListBean item) {
        switch (type) {
            case SWAP:
                helper.setText(R.id.ltv_dispose_staff_type,"选择对接人");
                break;
            case DIMISSION:
                helper.setText(R.id.ltv_dispose_staff_type,"离职");
                break;
            case ALLOT_ORDER:
                helper.setText(R.id.ltv_dispose_staff_type,"分配订单");
                break;
            default:
                break;
        }
        helper.setText(R.id.tv_dispose_staff_name,item.getTxt_Name());
        helper.setText(R.id.tv_dispose_staff_phone,item.getTxt_Phone());
        ImageView imageView = helper.getView(tiv_dispose_staff_head);
        GlideApp.with(mContext).load(item.getUrl_HeadPhoto()).placeholder(R.drawable.ic_headportrait)
                .error(R.drawable.ic_headportrait).circleCrop().into(imageView);

    }
    public enum DisposeEnum {
        /**
         * 交换
         */
        SWAP,
        /**
         * 离职
         */
        DIMISSION,
        /**
         * 分配订单
         */
        ALLOT_ORDER
    }
}
